package com.luo.search.controller;

import com.luo.common.restful.JsonPage;
import com.luo.common.restful.JsonResult;
import com.luo.pojo.search.QuestionForSearch;
import com.luo.search.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private ISearchService searchService;

    @GetMapping
    public JsonResult search(String keyword, Integer page, Integer pageSize){
        JsonPage<QuestionForSearch> jsonPage = searchService.search(keyword, page, pageSize);
        return JsonResult.ok(jsonPage);
    }
}
